package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

public class SearchPictureByMapUI extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	public final static ImageIcon IMG_SERVER_BACKGROUND = new ImageIcon("images/worldMap.jpg");
	private JLabel label;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					SearchPictureByMapUI frame = new SearchPictureByMapUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public SearchPictureByMapUI() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		
		setBounds(0, 0, 700, 700);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		label = new JLabel("");
		label.setBounds(10, 11, 674, 642);
		label.addComponentListener(new ComponentAdapter() {
			@Override
			public void componentHidden(ComponentEvent e) {
			}
		});
		contentPane.setLayout(null);

		label.setToolTipText("USA\r\n");
		label.setIcon(IMG_SERVER_BACKGROUND);
		label.setLayout(null);
		contentPane.add(label);
		
		JButton btnUsa = new JButton("USA");
		btnUsa.setToolTipText("USA");
		btnUsa.setBounds(139, 195, 71, 33);
		label.add(btnUsa);
		btnUsa.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				dispose();
			}
		});
		
		
		
		JButton btnSouthAmerica = new JButton("south america");
		btnSouthAmerica.setBounds(139, 374, 107, 33);
		label.add(btnSouthAmerica);
		btnSouthAmerica.setVisible(true);
		
		JButton btnRussia = new JButton("Russia");
		btnRussia.setBounds(370, 182, 89, 23);
		label.add(btnRussia);
		btnRussia.setVisible(true);
		
		JButton btnAustralia = new JButton("Australia");
		btnAustralia.setBounds(434, 401, 89, 23);
		label.add(btnAustralia);
		btnAustralia.setVisible(true);
		
		JButton btnAsia = new JButton("Asia");
		btnAsia.setBounds(396, 272, 89, 23);
		label.add(btnAsia);
		btnAsia.setVisible(true);
		
		
		JButton btnIsrael = new JButton("Israel");
		btnIsrael.setBounds(283, 243, 89, 23);
		label.add(btnIsrael);
		btnIsrael.setVisible(true);
		
		JButton btnAfrica = new JButton("Africa");
		btnAfrica.setBounds(244, 318, 89, 23);
		label.add(btnAfrica);
		btnAfrica.setVisible(true);
		this.setTitle("Search Picture in Map");
	}
}
